{extend name="layouts@base" /}
{block name="head"}
<link rel="stylesheet" href="__STATIC__/mobile/default/css/orderDetails.css" />
{/block}
{block name='pageType'}myOrder{/block}
{block name="main" }
    <div class="page-bd">
        <!-- 页面内容-->
        <div class="block ">
            <!-- <div class="orderBox">
                <div class="code fs28"><p class="color_3">订单编号:256385423663</p><span class="color_r">审核不通过</span></div>
                <div class="goodslist">
                    <a href="商品.html" class="goods">
                        <img src="__STATIC__/mobile/default/youLike01.png" alt="">
                        <div class="goodsinfo">
                            <p class="fs28 color_3">连帽系腰带鹅绒羽绒服大毛领手工刺绣羽...</p>
                            <span class="fs28 color_9">铁锈红-M码</span>
                            <div class="money">
                                <div class="color_3 fs24 num"><p class="fw_b fm_p">￥</p><em
                                        class="fs36">199</em><i>.00</i></div>
                                <em class="fs28 color_3">x4</em></div>
                        </div>
                    </a>
                </div>
                <div class="payment">
                    <div class="fs26 color_9">售后编号:<span class="color_3">256385423663</span></div>
                    <div class="fs26 color_9">售后时间:<span class="color_3">2019.11.12 23:36</span></div>
                </div>
                <div class="button">
                    <span class="fs28 fw_b color_w BGcolor_r">联系客服</span>
                </div>
            </div>
            <div class="orderBox">
                <div class="code fs28"><p class="color_3">订单编号:256385423663</p><span class="color_9">待审核</span></div>
                <div class="goodslist">
                    <a href="商品.html" class="goods">
                        <img src="__STATIC__/mobile/default/youLike01.png" alt="">
                        <div class="goodsinfo">
                            <p class="fs28 color_3">连帽系腰带鹅绒羽绒服大毛领手工刺绣羽...</p>
                            <span class="fs28 color_9">铁锈红-M码</span>
                            <div class="money">
                                <div class="color_3 fs24 num"><p class="fw_b fm_p">￥</p><em
                                        class="fs36">199</em><i>.00</i></div>
                                <em class="fs28 color_3">x4</em></div>
                        </div>
                    </a>
                </div>
                <div class="payment">
                    <div class="fs26 color_9">售后编号:<span class="color_3">256385423663</span></div>
                    <div class="fs26 color_9">售后时间:<span class="color_3">2019.11.12 23:36</span></div>
                </div>
            </div>
            <div class="orderBox">
                <div class="code fs28"><p class="color_3">订单编号:256385423663</p><span class="color_9">退货处理中</span></div>
                <div class="goodslist">
                    <a href="商品.html" class="goods">
                        <img src="__STATIC__/mobile/default/youLike01.png" alt="">
                        <div class="goodsinfo">
                            <p class="fs28 color_3">连帽系腰带鹅绒羽绒服大毛领手工刺绣羽...</p>
                            <span class="fs28 color_9">铁锈红-M码</span>
                            <div class="money">
                                <div class="color_3 fs24 num"><p class="fw_b fm_p">￥</p><em
                                        class="fs36">199</em><i>.00</i></div>
                                <em class="fs28 color_3">x4</em></div>
                        </div>
                    </a>
                </div>
                <div class="payment">
                    <div class="fs26 color_9">售后编号:<span class="color_3">256385423663</span></div>
                    <div class="fs26 color_9">售后时间:<span class="color_3">2019.11.12 23:36</span></div>
                </div>

            </div>
            <div class="orderBox">
                <div class="code fs28"><p class="color_3">订单编号:256385423663</p><span class="color_9">完成</span></div>
                <div class="goodslist">
                    <a href="商品.html" class="goods">
                        <img src="__STATIC__/mobile/default/youLike01.png" alt="">
                        <div class="goodsinfo">
                            <p class="fs28 color_3">连帽系腰带鹅绒羽绒服大毛领手工刺绣羽...</p>
                            <span class="fs28 color_9">铁锈红-M码</span>
                            <div class="money">
                                <div class="color_3 fs24 num"><p class="fw_b fm_p">￥</p><em
                                        class="fs36">199</em><i>.00</i></div>
                                <em class="fs28 color_3">x4</em></div>
                        </div>
                    </a>
                </div>
                <div class="payment">
                    <div class="fs26 color_9">售后编号:<span class="color_3">256385423663</span></div>
                    <div class="fs26 color_9">售后时间:<span class="color_3">2019.11.12 23:36</span></div>
                </div>

            </div> -->
        </div>
        <!-- 没有相关订单-->
        <script type="text/html" id="emptyTpl">
            <div class="empeyOrder">
                <img src="__STATIC__/mobile/default/images/emptyData.png" alt="">
                <span class="fs28 color_3">暂无相关订单</span>
            </div>
        </script>
        <script type="text/html" id="orderTpl">
            {{each list as item index}}
            <div class="orderBox">
                <div class="code fs28"><p class="color_3">订单编号:{{item.order_sn}}</p><span>{{item.status_name}}</span></div>
                <div class="goodslist">
                    <!-- <a href="{:_url('goods/info',['id'=>'[[item.goods_id]]'])}" class="goods"> -->
                    <a href="#" class="goods">
                        <img src="{{item.goods_pic}}" alt="">
                        <div class="goodsinfo">
                            <p class="fs28 color_3">{{item.goods_name}}</p>
                            <span class="fs28 color_9">{{item.sku_name}}</span>
                            <div class="money">
                                <div class="color_3 fs24 num"><p class="fw_b fm_p">￥</p><em
                                        class="fs36">{{item.refund_amount}}</em></div>
                                <em class="fs28 color_3">x{{item.goods_number}}</em></div>
                        </div>
                    </a>
                </div>
                <div class="payment">
                    <!-- <div class="fs26 color_9">售后编号:<span class="color_3">256385423663</span></div> -->
                    <div class="fs26 color_9">售后时间:<span class="color_3">{{item.add_time}}</span></div>
                </div>
            </div>
            {{/each}}
        </script>
    </div>

</div>
{/block}
{block name="footer"}
<!-- <script src="../assets/js/lib/jquery-2.1.4.js"></script>
<script src="../assets/js/lib/fastclick.js"></script>
<script src="../assets/js/art-template.js"></script> -->
<script>
    var nowPage = [],getAgain = [],isLoadend = [];
    var _type = 'saleReturns';
    var arr = new Object();
    $(function () {
        FastClick.attach(document.body);
        $('.page-bd').scroll(function(){
            var box_h=$(this).height()
            var content_h=$('.scrollBox').height()
            var scroll_h=$(this).scrollTop();
            if(content_h-box_h-scroll_h<20){
                getList();
            }
        })
        getList();
        //请求列表数据
        function getList(isagain) {
            page = nowPage[_type];
            if (typeof(page) == 'undefined') page = 1;
            if (isLoadend[_type] == true ) return false;
            if (isagain == true){
                if (getAgain[_type] == false) return false;
                getAgain[_type] = false;
            }else{
                $('.block').append('<div class="get_list_tip" data-type="'+_type+'">加载数据中...</div>');
            }
            isLoadend[_type] = true;
            arr.pages = page;
            jq_ajax('{:url("shop/api.order/saleafterlist")}',arr,function(res){
                isLoadend[_type] = false;
                // console.log(res);
                if(res.code  == 0 ){
                    _alert(res.msg);
                    getAgain[_type] = true;
                    $('.block').find('.get_list_tip').html('加载失败，点击重新加载.');
                    return false;
                }
                nowPage[_type] = page+1;
                $('.block').find('.get_list_tip').remove();
                if (res.list){
                    $('.block').append(template('orderTpl',res));
                }else{
                    $('.block').html(template('emptyTpl'));
                }

                if (res.page_count == page) {
                    $('.block').append('<div class="get_list_tip">---我也有底线的---</div>');
                    isLoadend[_type] = true;
                }
            })
        }
        //重新请求数据
        $(document).on('click','.get_list_tip',function () {
                _type = $(this).data('_type');
                getList(true);
        })
    });
    
</script>
<script>
</script>
{/block}
